<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="app"></div>
<button>+1</button>
<script>
    //定义一个count
    let count = 0
    //获取div元素
    const div = document.querySelector("div")
    // 获取button元素
    const button = document.querySelector("button")
    // 给div的textContent赋值
    div.textContent = count
    // 监听按钮的点击事件
    button.addEventListener("click", function () {
        // 使count+=1
        count += 1
        // 再次给div的textContent赋值
        div.textContent = count
    })
</script>
</body>
</html>